package May29ch21ex1;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class MySerialization {
	public static void main(String[] args) throws FileNotFoundException,
			IOException, ClassNotFoundException {

		// Truck truck = new Truck();
		// truck.setBrand("Chevo");
		// truck.setCapacity(200);
		//
		// ObjectOutputStream oOS = new ObjectOutputStream(new FileOutputStream(
		// "filename.txt"));
		// oOS.writeObject(truck);
		// oOS.close();

		Person person = new Person();
		person.setName("Maciej");
		person.setSurname("Kowalski");

		ObjectOutputStream oOS = new ObjectOutputStream(new FileOutputStream(
				"filename.txt"));
		oOS.writeObject(person);
		oOS.close();

		// ObjectInputStream iOS = new ObjectInputStream(new FileInputStream(
		// "filename.txt"));
		// Truck truck1 = (Truck) iOS.readObject();
		// System.out.println(truck1.getBrand());
		// System.out.println(truck1.getCapacity());
		// iOS.close();
		// System.out.println(truck1.getRegNo());
	}
}
// person w/ car; serialize deserialize
// person name surname